NewMenu
NewMenu
Get a handle to an empty menu short menuID ; your internal identifier for this menu
Str255 menuTitle ; length-prefixed string; text of title returns handle leading to empty MenuInfo structure This allocates heap storage for a menu and sets up the fields of an empty
pull-down menu that uses the standard menu definition procedure and has the
specified ID and title.
menuID is any positive integer value except 0. By convention, negative ID
numbers are reserved for Desk Accessories.
menuTitle is the address of a length-prefixed, Pascal-style string. It is the
title that will be displayed in the menu bar.
structure. The structure is initialized with menuID=menuID,
menuProc set to the standard menu definition routine, and menuData
=menuTitle .
Notes: NewMenu simply allocates and initializes a MenuInfo structure and its handle. It does not store the menu items or add the menu to the menu bar or
display the menu.
to store items into the menu. Use InsertMenu to put the menu in the menu to release the memory used by this menu.
An often-used alternative to this function is GetMenu, that reads the menu definition, including all items, from a resource (type 'MENU').
definition routine.
The following example illustrates the use of this command to create and
display a 3-menu menu bar:
Example
#include <Menus.h>
appleMenu = NewMenu( 1, "\p\024" ); /* create "Apple" menu () */
AppendMenu( appleMenu, "\p(-" ); /* dotted line */ AddResMenu( appleMenu, 'DRVR' ); /* Add DA list */ InsertMenu( appleMenu, 0 ); /* install in menu bar */ AppendMenu( fileMenu, "\pOpen.../O;Save/S;(-;Quit/Q" ); optionsMenu = NewMenu( 3,"\pOptions" ); AppendMenu( optionsMenu, "\pBig/B;Little/L;(-;Colors..." );